package com.sandking.db.bean;

import java.util.ArrayList;
import com.sandking.tools.SK_Map;
import com.alibaba.fastjson.JSON;
import java.util.Map;
import com.sandking.io.SK_OutputStream;
import java.util.List;
import com.sandking.db.cache.YxjnCache;
import com.sandking.db.cache.YhjzCache;
import java.util.HashMap;
import com.sandking.db.cache.BydlCache;
import com.sandking.db.cache.YhCache;
import com.sandking.io.SK_InputStream;
import com.sandking.db.cache.YhyxCache;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

/**
 * 用户英雄
 */
public class Yhyx {

	public static final String TABLENAME = "用户英雄";
	public static final String CLASSNAME = "Yhyx"; 
	/**
	 * 需要更新字段集
	 */
	private Map<String, Object> updateColumns;

	/** id */
	private int id;
	
	/** 用户_id */
	private int yh_id;
	
	/** tempid */
	private int tempid;
	
	/** 英雄id */
	private int yxid;
	
	/** 英雄lvl */
	private int yxlvl;
	
	/** 拥兵数 */
	private int ybs;
	
	/** 放兵数 */
	private int fbs;
	
	/** 英雄exp */
	private int yxexp;
	
	/** 锁定 */
	private boolean sd;
	
	/** 用户建筑_id */
	private int yhjz_id;
	
	/** 用户建筑tempid */
	private int yhjztempid;
	
	/** 上次修炼时间 */
	private java.util.Date scxlsj;
	
	/** 修炼成功率 */
	private int xlcgl;
	
	/** 攻击修炼加成 */
	private int gjxljc;
	
	/** 生命修炼加成 */
	private int smxljc;
	
	/** 是否修炼过 */
	private boolean sfxlg;
	
	/** 驻防 */
	private boolean zf;
	
	/** 自动招兵 */
	private boolean zdzb;
	
	/** 战斗力 */
	private int zdl;
	
	
	public Yhyx() {
		super();
	}
	
	public Yhyx(int id, int yh_id, int tempid, int yxid, int yxlvl, int ybs, int fbs, int yxexp, boolean sd, int yhjz_id, int yhjztempid, java.util.Date scxlsj, int xlcgl, int gjxljc, int smxljc, boolean sfxlg, boolean zf, boolean zdzb, int zdl) {
		super();
		this.id = id;
		this.yh_id = yh_id;
		this.tempid = tempid;
		this.yxid = yxid;
		this.yxlvl = yxlvl;
		this.ybs = ybs;
		this.fbs = fbs;
		this.yxexp = yxexp;
		this.sd = sd;
		this.yhjz_id = yhjz_id;
		this.yhjztempid = yhjztempid;
		this.scxlsj = scxlsj;
		this.xlcgl = xlcgl;
		this.gjxljc = gjxljc;
		this.smxljc = smxljc;
		this.sfxlg = sfxlg;
		this.zf = zf;
		this.zdzb = zdzb;
		this.zdl = zdl;
	}
	
	public Map<String, Object> getUpdateColumns() {
		if(updateColumns == null)
			updateColumns = new HashMap<String, Object>();
		return updateColumns;
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
		addUpdateColumn("id",id);
	}
	
	public void changeIdWith(int id){
		this.id += id;
		setId(this.id);
	}
	
	public void changeIdWithMin(int id,int min){
		this.id += id;
		this.id = this.id < min ? min : this.id;
		setId(this.id);
	}
	
	public void changeIdWithMax(int id,int max){
		this.id += id;
		this.id = this.id > max ? max : this.id;
		setId(this.id);
	}
	
	public void changeIdWithMaxMin(int id,int max,int min){
		this.id += id;
		this.id = this.id < min ? min : this.id;
		this.id = this.id > max ? max : this.id;
		setId(this.id);
	}	
	public int getYh_id() {
		return yh_id;
	}
	
	public void setYh_id(int yh_id) {
		this.yh_id = yh_id;
		addUpdateColumn("用户_id",yh_id);
	}
	
	public void changeYh_idWith(int yh_id){
		this.yh_id += yh_id;
		setYh_id(this.yh_id);
	}
	
	public void changeYh_idWithMin(int yh_id,int min){
		this.yh_id += yh_id;
		this.yh_id = this.yh_id < min ? min : this.yh_id;
		setYh_id(this.yh_id);
	}
	
	public void changeYh_idWithMax(int yh_id,int max){
		this.yh_id += yh_id;
		this.yh_id = this.yh_id > max ? max : this.yh_id;
		setYh_id(this.yh_id);
	}
	
	public void changeYh_idWithMaxMin(int yh_id,int max,int min){
		this.yh_id += yh_id;
		this.yh_id = this.yh_id < min ? min : this.yh_id;
		this.yh_id = this.yh_id > max ? max : this.yh_id;
		setYh_id(this.yh_id);
	}	
	public int getTempid() {
		return tempid;
	}
	
	public void setTempid(int tempid) {
		this.tempid = tempid;
		addUpdateColumn("tempid",tempid);
	}
	
	public void changeTempidWith(int tempid){
		this.tempid += tempid;
		setTempid(this.tempid);
	}
	
	public void changeTempidWithMin(int tempid,int min){
		this.tempid += tempid;
		this.tempid = this.tempid < min ? min : this.tempid;
		setTempid(this.tempid);
	}
	
	public void changeTempidWithMax(int tempid,int max){
		this.tempid += tempid;
		this.tempid = this.tempid > max ? max : this.tempid;
		setTempid(this.tempid);
	}
	
	public void changeTempidWithMaxMin(int tempid,int max,int min){
		this.tempid += tempid;
		this.tempid = this.tempid < min ? min : this.tempid;
		this.tempid = this.tempid > max ? max : this.tempid;
		setTempid(this.tempid);
	}	
	public int getYxid() {
		return yxid;
	}
	
	public void setYxid(int yxid) {
		this.yxid = yxid;
		addUpdateColumn("英雄id",yxid);
	}
	
	public void changeYxidWith(int yxid){
		this.yxid += yxid;
		setYxid(this.yxid);
	}
	
	public void changeYxidWithMin(int yxid,int min){
		this.yxid += yxid;
		this.yxid = this.yxid < min ? min : this.yxid;
		setYxid(this.yxid);
	}
	
	public void changeYxidWithMax(int yxid,int max){
		this.yxid += yxid;
		this.yxid = this.yxid > max ? max : this.yxid;
		setYxid(this.yxid);
	}
	
	public void changeYxidWithMaxMin(int yxid,int max,int min){
		this.yxid += yxid;
		this.yxid = this.yxid < min ? min : this.yxid;
		this.yxid = this.yxid > max ? max : this.yxid;
		setYxid(this.yxid);
	}	
	public int getYxlvl() {
		return yxlvl;
	}
	
	public void setYxlvl(int yxlvl) {
		this.yxlvl = yxlvl;
		addUpdateColumn("英雄lvl",yxlvl);
	}
	
	public void changeYxlvlWith(int yxlvl){
		this.yxlvl += yxlvl;
		setYxlvl(this.yxlvl);
	}
	
	public void changeYxlvlWithMin(int yxlvl,int min){
		this.yxlvl += yxlvl;
		this.yxlvl = this.yxlvl < min ? min : this.yxlvl;
		setYxlvl(this.yxlvl);
	}
	
	public void changeYxlvlWithMax(int yxlvl,int max){
		this.yxlvl += yxlvl;
		this.yxlvl = this.yxlvl > max ? max : this.yxlvl;
		setYxlvl(this.yxlvl);
	}
	
	public void changeYxlvlWithMaxMin(int yxlvl,int max,int min){
		this.yxlvl += yxlvl;
		this.yxlvl = this.yxlvl < min ? min : this.yxlvl;
		this.yxlvl = this.yxlvl > max ? max : this.yxlvl;
		setYxlvl(this.yxlvl);
	}	
	public int getYbs() {
		return ybs;
	}
	
	public void setYbs(int ybs) {
		this.ybs = ybs;
		addUpdateColumn("拥兵数",ybs);
	}
	
	public void changeYbsWith(int ybs){
		this.ybs += ybs;
		setYbs(this.ybs);
	}
	
	public void changeYbsWithMin(int ybs,int min){
		this.ybs += ybs;
		this.ybs = this.ybs < min ? min : this.ybs;
		setYbs(this.ybs);
	}
	
	public void changeYbsWithMax(int ybs,int max){
		this.ybs += ybs;
		this.ybs = this.ybs > max ? max : this.ybs;
		setYbs(this.ybs);
	}
	
	public void changeYbsWithMaxMin(int ybs,int max,int min){
		this.ybs += ybs;
		this.ybs = this.ybs < min ? min : this.ybs;
		this.ybs = this.ybs > max ? max : this.ybs;
		setYbs(this.ybs);
	}	
	public int getFbs() {
		return fbs;
	}
	
	public void setFbs(int fbs) {
		this.fbs = fbs;
		addUpdateColumn("放兵数",fbs);
	}
	
	public void changeFbsWith(int fbs){
		this.fbs += fbs;
		setFbs(this.fbs);
	}
	
	public void changeFbsWithMin(int fbs,int min){
		this.fbs += fbs;
		this.fbs = this.fbs < min ? min : this.fbs;
		setFbs(this.fbs);
	}
	
	public void changeFbsWithMax(int fbs,int max){
		this.fbs += fbs;
		this.fbs = this.fbs > max ? max : this.fbs;
		setFbs(this.fbs);
	}
	
	public void changeFbsWithMaxMin(int fbs,int max,int min){
		this.fbs += fbs;
		this.fbs = this.fbs < min ? min : this.fbs;
		this.fbs = this.fbs > max ? max : this.fbs;
		setFbs(this.fbs);
	}	
	public int getYxexp() {
		return yxexp;
	}
	
	public void setYxexp(int yxexp) {
		this.yxexp = yxexp;
		addUpdateColumn("英雄exp",yxexp);
	}
	
	public void changeYxexpWith(int yxexp){
		this.yxexp += yxexp;
		setYxexp(this.yxexp);
	}
	
	public void changeYxexpWithMin(int yxexp,int min){
		this.yxexp += yxexp;
		this.yxexp = this.yxexp < min ? min : this.yxexp;
		setYxexp(this.yxexp);
	}
	
	public void changeYxexpWithMax(int yxexp,int max){
		this.yxexp += yxexp;
		this.yxexp = this.yxexp > max ? max : this.yxexp;
		setYxexp(this.yxexp);
	}
	
	public void changeYxexpWithMaxMin(int yxexp,int max,int min){
		this.yxexp += yxexp;
		this.yxexp = this.yxexp < min ? min : this.yxexp;
		this.yxexp = this.yxexp > max ? max : this.yxexp;
		setYxexp(this.yxexp);
	}	
	public boolean getSd() {
		return sd;
	}
	
	public void setSd(boolean sd) {
		this.sd = sd;
		addUpdateColumn("锁定",sd);
	}
	
	public int getYhjz_id() {
		return yhjz_id;
	}
	
	public void setYhjz_id(int yhjz_id) {
		this.yhjz_id = yhjz_id;
		addUpdateColumn("用户建筑_id",yhjz_id);
	}
	
	public void changeYhjz_idWith(int yhjz_id){
		this.yhjz_id += yhjz_id;
		setYhjz_id(this.yhjz_id);
	}
	
	public void changeYhjz_idWithMin(int yhjz_id,int min){
		this.yhjz_id += yhjz_id;
		this.yhjz_id = this.yhjz_id < min ? min : this.yhjz_id;
		setYhjz_id(this.yhjz_id);
	}
	
	public void changeYhjz_idWithMax(int yhjz_id,int max){
		this.yhjz_id += yhjz_id;
		this.yhjz_id = this.yhjz_id > max ? max : this.yhjz_id;
		setYhjz_id(this.yhjz_id);
	}
	
	public void changeYhjz_idWithMaxMin(int yhjz_id,int max,int min){
		this.yhjz_id += yhjz_id;
		this.yhjz_id = this.yhjz_id < min ? min : this.yhjz_id;
		this.yhjz_id = this.yhjz_id > max ? max : this.yhjz_id;
		setYhjz_id(this.yhjz_id);
	}	
	public int getYhjztempid() {
		return yhjztempid;
	}
	
	public void setYhjztempid(int yhjztempid) {
		this.yhjztempid = yhjztempid;
		addUpdateColumn("用户建筑tempid",yhjztempid);
	}
	
	public void changeYhjztempidWith(int yhjztempid){
		this.yhjztempid += yhjztempid;
		setYhjztempid(this.yhjztempid);
	}
	
	public void changeYhjztempidWithMin(int yhjztempid,int min){
		this.yhjztempid += yhjztempid;
		this.yhjztempid = this.yhjztempid < min ? min : this.yhjztempid;
		setYhjztempid(this.yhjztempid);
	}
	
	public void changeYhjztempidWithMax(int yhjztempid,int max){
		this.yhjztempid += yhjztempid;
		this.yhjztempid = this.yhjztempid > max ? max : this.yhjztempid;
		setYhjztempid(this.yhjztempid);
	}
	
	public void changeYhjztempidWithMaxMin(int yhjztempid,int max,int min){
		this.yhjztempid += yhjztempid;
		this.yhjztempid = this.yhjztempid < min ? min : this.yhjztempid;
		this.yhjztempid = this.yhjztempid > max ? max : this.yhjztempid;
		setYhjztempid(this.yhjztempid);
	}	
	public java.util.Date getScxlsj() {
		return scxlsj;
	}
	
	public void setScxlsj(java.util.Date scxlsj) {
		this.scxlsj = scxlsj;
		addUpdateColumn("上次修炼时间",scxlsj);
	}
	
	public int getXlcgl() {
		return xlcgl;
	}
	
	public void setXlcgl(int xlcgl) {
		this.xlcgl = xlcgl;
		addUpdateColumn("修炼成功率",xlcgl);
	}
	
	public void changeXlcglWith(int xlcgl){
		this.xlcgl += xlcgl;
		setXlcgl(this.xlcgl);
	}
	
	public void changeXlcglWithMin(int xlcgl,int min){
		this.xlcgl += xlcgl;
		this.xlcgl = this.xlcgl < min ? min : this.xlcgl;
		setXlcgl(this.xlcgl);
	}
	
	public void changeXlcglWithMax(int xlcgl,int max){
		this.xlcgl += xlcgl;
		this.xlcgl = this.xlcgl > max ? max : this.xlcgl;
		setXlcgl(this.xlcgl);
	}
	
	public void changeXlcglWithMaxMin(int xlcgl,int max,int min){
		this.xlcgl += xlcgl;
		this.xlcgl = this.xlcgl < min ? min : this.xlcgl;
		this.xlcgl = this.xlcgl > max ? max : this.xlcgl;
		setXlcgl(this.xlcgl);
	}	
	public int getGjxljc() {
		return gjxljc;
	}
	
	public void setGjxljc(int gjxljc) {
		this.gjxljc = gjxljc;
		addUpdateColumn("攻击修炼加成",gjxljc);
	}
	
	public void changeGjxljcWith(int gjxljc){
		this.gjxljc += gjxljc;
		setGjxljc(this.gjxljc);
	}
	
	public void changeGjxljcWithMin(int gjxljc,int min){
		this.gjxljc += gjxljc;
		this.gjxljc = this.gjxljc < min ? min : this.gjxljc;
		setGjxljc(this.gjxljc);
	}
	
	public void changeGjxljcWithMax(int gjxljc,int max){
		this.gjxljc += gjxljc;
		this.gjxljc = this.gjxljc > max ? max : this.gjxljc;
		setGjxljc(this.gjxljc);
	}
	
	public void changeGjxljcWithMaxMin(int gjxljc,int max,int min){
		this.gjxljc += gjxljc;
		this.gjxljc = this.gjxljc < min ? min : this.gjxljc;
		this.gjxljc = this.gjxljc > max ? max : this.gjxljc;
		setGjxljc(this.gjxljc);
	}	
	public int getSmxljc() {
		return smxljc;
	}
	
	public void setSmxljc(int smxljc) {
		this.smxljc = smxljc;
		addUpdateColumn("生命修炼加成",smxljc);
	}
	
	public void changeSmxljcWith(int smxljc){
		this.smxljc += smxljc;
		setSmxljc(this.smxljc);
	}
	
	public void changeSmxljcWithMin(int smxljc,int min){
		this.smxljc += smxljc;
		this.smxljc = this.smxljc < min ? min : this.smxljc;
		setSmxljc(this.smxljc);
	}
	
	public void changeSmxljcWithMax(int smxljc,int max){
		this.smxljc += smxljc;
		this.smxljc = this.smxljc > max ? max : this.smxljc;
		setSmxljc(this.smxljc);
	}
	
	public void changeSmxljcWithMaxMin(int smxljc,int max,int min){
		this.smxljc += smxljc;
		this.smxljc = this.smxljc < min ? min : this.smxljc;
		this.smxljc = this.smxljc > max ? max : this.smxljc;
		setSmxljc(this.smxljc);
	}	
	public boolean getSfxlg() {
		return sfxlg;
	}
	
	public void setSfxlg(boolean sfxlg) {
		this.sfxlg = sfxlg;
		addUpdateColumn("是否修炼过",sfxlg);
	}
	
	public boolean getZf() {
		return zf;
	}
	
	public void setZf(boolean zf) {
		this.zf = zf;
		addUpdateColumn("驻防",zf);
	}
	
	public boolean getZdzb() {
		return zdzb;
	}
	
	public void setZdzb(boolean zdzb) {
		this.zdzb = zdzb;
		addUpdateColumn("自动招兵",zdzb);
	}
	
	public int getZdl() {
		return zdl;
	}
	
	public void setZdl(int zdl) {
		this.zdl = zdl;
		addUpdateColumn("战斗力",zdl);
	}
	
	public void changeZdlWith(int zdl){
		this.zdl += zdl;
		setZdl(this.zdl);
	}
	
	public void changeZdlWithMin(int zdl,int min){
		this.zdl += zdl;
		this.zdl = this.zdl < min ? min : this.zdl;
		setZdl(this.zdl);
	}
	
	public void changeZdlWithMax(int zdl,int max){
		this.zdl += zdl;
		this.zdl = this.zdl > max ? max : this.zdl;
		setZdl(this.zdl);
	}
	
	public void changeZdlWithMaxMin(int zdl,int max,int min){
		this.zdl += zdl;
		this.zdl = this.zdl < min ? min : this.zdl;
		this.zdl = this.zdl > max ? max : this.zdl;
		setZdl(this.zdl);
	}	
	
	//id
	public Bydl getBydlsFkYhyx_id(){
		return BydlCache.getByYhyx_id(id);
	}
	
	//id
	public List<Yxjn> getYxjnsFkYhyx_id(){
		return YxjnCache.getByYhyx_id(id);
	}
	
	//用户_id
	public Yh getYhPkYh_id(){
		return YhCache.getById(yh_id);
	}
	//用户建筑_id
	public Yhjz getYhjzPkYhjz_id(){
		return YhjzCache.getById(yhjz_id);
	}
	public void addUpdateColumn(String key, Object val) {
		Map<String, Object> map = getUpdateColumns();
		if (map == null)
			return;
		map.put(key, val);
	}
	
	public void clearUpdateColumn() {
		Map<String, Object> map = getUpdateColumns();
		if (map == null)
			return;
		map.clear();
	}
	
	public Map<String, Object> toMap(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("id", this.id);
        result.put("yh_id", this.yh_id);
        result.put("tempid", this.tempid);
        result.put("yxid", this.yxid);
        result.put("yxlvl", this.yxlvl);
        result.put("ybs", this.ybs);
        result.put("fbs", this.fbs);
        result.put("yxexp", this.yxexp);
        result.put("sd", this.sd);
        result.put("yhjz_id", this.yhjz_id);
        result.put("yhjztempid", this.yhjztempid);
        result.put("scxlsj", this.scxlsj);
        result.put("xlcgl", this.xlcgl);
        result.put("gjxljc", this.gjxljc);
        result.put("smxljc", this.smxljc);
        result.put("sfxlg", this.sfxlg);
        result.put("zf", this.zf);
        result.put("zdzb", this.zdzb);
        result.put("zdl", this.zdl);
        return result;
    }
    
    public String toString(){
        return toMap().toString();
    }
    
    public String toJson(){
    	return JSON.toJSONString(toMap());
    }
    
    /**
     * 数据库源字段Map
     */
    public Map<String, Object> toColumnNameMap(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("id", this.id);
        result.put("用户_id", this.yh_id);
        result.put("tempid", this.tempid);
        result.put("英雄id", this.yxid);
        result.put("英雄lvl", this.yxlvl);
        result.put("拥兵数", this.ybs);
        result.put("放兵数", this.fbs);
        result.put("英雄exp", this.yxexp);
        result.put("锁定", this.sd);
        result.put("用户建筑_id", this.yhjz_id);
        result.put("用户建筑tempid", this.yhjztempid);
        result.put("上次修炼时间", this.scxlsj);
        result.put("修炼成功率", this.xlcgl);
        result.put("攻击修炼加成", this.gjxljc);
        result.put("生命修炼加成", this.smxljc);
        result.put("是否修炼过", this.sfxlg);
        result.put("驻防", this.zf);
        result.put("自动招兵", this.zdzb);
        result.put("战斗力", this.zdl);
        return result;
    }
    
    public String toColumnNameString(){
        return toColumnNameMap().toString();
    }
    
    public byte[] toBytes() throws Exception {
    	try (ByteArrayOutputStream out = new ByteArrayOutputStream();) {
		    SK_OutputStream.writeInt(out,this.id);
		    SK_OutputStream.writeInt(out,this.yh_id);
		    SK_OutputStream.writeInt(out,this.tempid);
		    SK_OutputStream.writeInt(out,this.yxid);
		    SK_OutputStream.writeInt(out,this.yxlvl);
		    SK_OutputStream.writeInt(out,this.ybs);
		    SK_OutputStream.writeInt(out,this.fbs);
		    SK_OutputStream.writeInt(out,this.yxexp);
		    SK_OutputStream.writeInt(out,this.yhjz_id);
		    SK_OutputStream.writeInt(out,this.yhjztempid);
		    SK_OutputStream.writeInt(out,this.xlcgl);
		    SK_OutputStream.writeInt(out,this.gjxljc);
		    SK_OutputStream.writeInt(out,this.smxljc);
		    SK_OutputStream.writeInt(out,this.zdl);
		    return out.toByteArray();
    	}catch (Exception e) {
            throw e;
        }
    }
    
     public static Yhyx createForBytes(byte[] _byte) throws Exception {
     	try (ByteArrayInputStream in = new ByteArrayInputStream(_byte);) {
	     	Yhyx yhyx = new Yhyx();
		    yhyx.id = SK_InputStream.readInt(in,null);
		    yhyx.yh_id = SK_InputStream.readInt(in,null);
		    yhyx.tempid = SK_InputStream.readInt(in,null);
		    yhyx.yxid = SK_InputStream.readInt(in,null);
		    yhyx.yxlvl = SK_InputStream.readInt(in,null);
		    yhyx.ybs = SK_InputStream.readInt(in,null);
		    yhyx.fbs = SK_InputStream.readInt(in,null);
		    yhyx.yxexp = SK_InputStream.readInt(in,null);
		    yhyx.yhjz_id = SK_InputStream.readInt(in,null);
		    yhyx.yhjztempid = SK_InputStream.readInt(in,null);
		    yhyx.xlcgl = SK_InputStream.readInt(in,null);
		    yhyx.gjxljc = SK_InputStream.readInt(in,null);
		    yhyx.smxljc = SK_InputStream.readInt(in,null);
		    yhyx.zdl = SK_InputStream.readInt(in,null);
		    return yhyx;
    	}catch (Exception e) {
            throw e;
        }
     }
    
    /**
     * 根据list创建对象
     */
    public static List<Yhyx> createForColumnNameList(List<Map<String, Object>> list){
    	List<Yhyx> yhyxs = new ArrayList<Yhyx>();
		for (Map<String, Object> map : list) {
			yhyxs.add(createForColumnNameMap(map));
		}
		return yhyxs;
    }
    
    /**
     * 根据map创建对象
     */
    public static Yhyx createForColumnNameMap(Map<String, Object> map){
    	Yhyx obj = new Yhyx();
	    obj.id = SK_Map.getInt("id", map);
	    obj.yh_id = SK_Map.getInt("用户_id", map);
	    obj.tempid = SK_Map.getInt("tempid", map);
	    obj.yxid = SK_Map.getInt("英雄id", map);
	    obj.yxlvl = SK_Map.getInt("英雄lvl", map);
	    obj.ybs = SK_Map.getInt("拥兵数", map);
	    obj.fbs = SK_Map.getInt("放兵数", map);
	    obj.yxexp = SK_Map.getInt("英雄exp", map);
	    obj.yhjz_id = SK_Map.getInt("用户建筑_id", map);
	    obj.yhjztempid = SK_Map.getInt("用户建筑tempid", map);
	    obj.xlcgl = SK_Map.getInt("修炼成功率", map);
	    obj.gjxljc = SK_Map.getInt("攻击修炼加成", map);
	    obj.smxljc = SK_Map.getInt("生命修炼加成", map);
	    obj.zdl = SK_Map.getInt("战斗力", map);
        return obj;
    }
    
    /**
     * 根据list创建对象
     */
    public static List<Yhyx> createForList(List<Map<String, Object>> list){
    	List<Yhyx> yhyxs = new ArrayList<Yhyx>();
		for (Map<String, Object> map : list) {
			yhyxs.add(createForColumnNameMap(map));
		}
		return yhyxs;
    }
    
    /**
     * 根据map创建对象
     */
    public static Yhyx createForMap(Map<String, Object> map){
    	Yhyx obj = new Yhyx();
	    obj.id = SK_Map.getInt("id", map);
	    obj.yh_id = SK_Map.getInt("yh_id", map);
	    obj.tempid = SK_Map.getInt("tempid", map);
	    obj.yxid = SK_Map.getInt("yxid", map);
	    obj.yxlvl = SK_Map.getInt("yxlvl", map);
	    obj.ybs = SK_Map.getInt("ybs", map);
	    obj.fbs = SK_Map.getInt("fbs", map);
	    obj.yxexp = SK_Map.getInt("yxexp", map);
	    obj.yhjz_id = SK_Map.getInt("yhjz_id", map);
	    obj.yhjztempid = SK_Map.getInt("yhjztempid", map);
	    obj.xlcgl = SK_Map.getInt("xlcgl", map);
	    obj.gjxljc = SK_Map.getInt("gjxljc", map);
	    obj.smxljc = SK_Map.getInt("smxljc", map);
	    obj.zdl = SK_Map.getInt("zdl", map);
        return obj;
    }
    
    public static Yhyx createForJson(String json){
    	Map<String, Object> map = JSON.parseObject(json);
    	return createForMap(map);
    }
    
    public static List<Yhyx> createForJson(List<String> jsons){
    	List<Yhyx> yhyxs = new ArrayList<Yhyx>();
    	for(String json : jsons){
    		yhyxs.add(createForJson(json));
    	}
    	return yhyxs;
    }
    
    /** 延迟插入数据库 */
    public Yhyx insert(){
    	return YhyxCache.insert(this);
    }
    /** 延迟更新数据库 */
    public Yhyx update(){
    	return YhyxCache.update(this);
    }
    /** 延迟删除数据库 */
    public boolean delete(){
    	return YhyxCache.delete(this);
    }
    /** 即时插入数据库 */
    public Yhyx insertAndFlush(){
    	return YhyxCache.insertAndFlush(this);
    }
    /** 即时更新数据库 */
    public Yhyx updateAndFlush(){
    	return YhyxCache.updateAndFlush(this);
    }
    /** 即时删除数据库 */
    public boolean deleteAndFlush(){
    	return YhyxCache.deleteAndFlush(this);
    }
}